package com.example.mrzhou.lvmm.presenter.surround;

import com.example.mrzhou.lvmm.entity.surround.hotel.Hotel;
import com.example.mrzhou.lvmm.model.ModelFactory;
import com.example.mrzhou.lvmm.view.impl.surround.HotelView;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Mr.zhou on 2016/10/27.
 */

public class HotelPresenter {

    private HotelView hotelView;

    public HotelPresenter(HotelView hotelView) {
        this.hotelView = hotelView;
    }

    public void getHotelData(Map<String, String> map) {
        ModelFactory.getISurModel().getHotelData(map, new Subscriber<Hotel>() {
            @Override
            public void onCompleted() {
                hotelView.onFinsh();
            }

            @Override
            public void onError(Throwable e) {
                hotelView.onFaiure(e);
            }

            @Override
            public void onNext(Hotel hotel) {
                hotelView.onSuccess(hotel);
            }
        });
    }

}
